@extends('admin.layout.common')
@section('content')
    <link rel="stylesheet" type="text/css" href="{{URL::asset('css/user/AddEmployees.css')}}">
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <style>
        .error{
            color:red;
        }
    </style>
    <div class="content">
        <h1>编辑员工</h1>
        @include('flash::message')
        <form method="post" class="cmxform" id="addForm" action="">
            {{csrf_field()}}
            <input type="hidden"/>

            <p><label for="work_number">坐席工号：<input id="work_number" type="text" name="" value=""></label></p>
            <p>
                <label for="real_name">职工姓名：<input id="real_name" type="text" name="real_name" value="{{$info['real_name']}}"></label>
                <label for="phone">联系电话：<input id="phone" type="text" name="phone" number value="{{$info['phone']}}"></label>
                <label for="email">工作邮箱：<input type="email" name="email" value="{{$info['email']}}"></label><br/>
            </p>
            <p>
                {{--<label for="">所在部门：<input type="text" name="department"></label>--}}
                <label for="">所在部门：
                    <select name="department" id="">
                        <option value="">所在部门选择</option>
                        @foreach($depData as $v)
                            <option @if($v['id'] == $info['department']) selected @endif value="{{$v['id']}}">{{$v['name_cn']}}</option>
                        @endforeach
                    </select>
                </label>
                <label for="role_ids"><span class="red_icon">*</span>角色职务：
                    <select name="role_ids" style="" required>
                        <option value="">--请选择--</option>
                        @foreach($role as $v)
                            <option @if($v['id'] == $info['role_ids']) selected @endif value="{{$v['id']}}">{{$v['name']}}</option>
                        @endforeach
                    </select>
                </label>
                <label for="work_name">岗位名称：
                    <input id="work_name" type="text" name="work_name" value="{{$info['work_name']}}">
                </label><br/>
            </p>
            <p>
                <label for="name"><span class="red_icon">*</span>登录名：&nbsp;&nbsp;<input type="text" name="name" value="{{$info['name']}}"></label>
            </p>

            <p class="last_p"><input class="submit" type="submit" name="" value="确定信息"></p>
            <input type="hidden" name="id" value="{{$info['id']}}">
        </form>
    </div>

<script type="text/javascript" src="{{URL::asset('js/user/AddEmployees.js')}}"></script>
<script>
    $().ready(function() {
        $("#addForm").validate({
            rules: {
                // work_number: {
                //     required: true,
                //     number: true,
                //     minlength: 2,
                // },
                real_name: {
                    required: true,
                    minlength: 2,
                },
                department: {
                    required: true
                },
                phone: {
                    required: true,
                    maxlength: 11,
                    number: true
                },
                email: {
                    required: true,
                    email: true
                },
                role_ids: {
                    required: true,
                },
                work_name: {
                    required: true,
                    minlength: 2,
                },
                name: {
                    required: true,
                    minlength: 2,
                }
            },
            messages: {
                work_number: {
                    required: "请输入正确坐席工号",
                    number: "请输入有效的数字",
                    minlength: "长度最少2个字符"
                },
                real_name: {
                    required: "请输入职工姓名",
                    minlength: "职工姓名最少由两个字符组成",
                },
                department: {
                    required: "请选择所在部门"
                },
                phone: {
                    number:"",
                    required: "请输入联系电话",
                    maxlength: "请正确填写电话号码",
                    number:''
                },
                email: "请输入一个正确的邮箱",
                role_ids: {
                    required: "请选择角色职务"
                },
                work_name: {
                    required: "请输入岗位名称",
                    minlength: "岗位名称最少由两个字符组成",
                },
                name: {
                    required: "请输入登录名",
                    minlength: "登录名最少由两个字符组成",
                }
            }
        })
    });

</script>
@endsection
